/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.sys.service;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.chlitina.store.common.persistence.Page;
import com.chlitina.store.common.service.BaseService;
import com.chlitina.store.modules.sys.dao.StoreLoginDao;
import com.chlitina.store.modules.sys.entity.StoreLogin;

/**
 * ipad地址绑定Service
 * @author liujiang
 * @version 2013-09-22
 */
@Component
@Transactional(readOnly = true)
public class StoreLoginService extends BaseService {

	@SuppressWarnings("unused")
	private static Logger logger = LoggerFactory.getLogger(StoreLoginService.class);
	
	@Autowired
	private StoreLoginDao storeLoginDao;
	
	public StoreLogin get(Long id) {
		return storeLoginDao.findOne(id);
	}
	
	public Page<StoreLogin> find(Page<StoreLogin> page, StoreLogin storeIpad) {
		DetachedCriteria dc = storeLoginDao.createDetachedCriteria();
		dc.addOrder(Order.desc("id"));
		return storeLoginDao.find(page, dc);
	}
	
	@Transactional(readOnly = false)
	public void save(StoreLogin storeIpad) {
		storeLoginDao.save(storeIpad);
	}
	
	@Transactional(readOnly = false)
	public void delete(Long id) {
		storeLoginDao.delete(id);
	}
}
